<?php
	$atras=$pagina-1;
	
	if($pagina==$total_paginas)
		$siguiente=0;
	else 
		$siguiente=$pagina+1;
?>
<style type="text/css">

.container {
        width: 790px;
        padding: 0;
        margin: 0 auto;
}
.folio_block {
        position: absolute;
        left: 50%; top: 50%;
        margin: -140px 0 0 -395px;
}


/*--Main Container--*/
.main_view {
        float: left;
        position: relative;
}
/*--Window/Masking Styles--*/
.window {
        height:286px;   width: 790px;
        overflow: hidden; /*--Hides anything outside of the set width/height--*/
        position: relative;
}
.image_reel {
        position: absolute;
        top: 0;
        left: -1px;
}
.image_reel img {float: left;}

/*--Paging Styles--*/
.paging {
        position: absolute;
        bottom: 40px; right: -7px;
        width: 178px; height:47px;
        z-index: 100; /*--Assures the paging stays on the top layer--*/
        text-align: center;
        line-height: 40px;
        background: url(view/imagenes/paging_bg2.png) no-repeat;
        display: none; /*--Hidden by default, will be later shown with jQuery--*/
}
.paging a {
        padding: 5px;
        text-decoration: none;
        color: #fff;
}
.paging a.active {
        font-weight: bold; 
        background: #920000; 
        border: 1px solid #610000;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
}
.paging a:hover {font-weight: bold;}
</style>
<script type="text/javascript">

$(document).ready(function() {

        //Set Default State of each portfolio piece
        $(".paging").show();
        $(".paging a:first").addClass("active");
                
        //Get size of images, how many there are, then determin the size of the image reel.
        var imageWidth = $(".window").width();
        var imageSum = $(".image_reel img").size();
        var imageReelWidth = imageWidth * imageSum;
        
        //Adjust the image reel to its new size
        $(".image_reel").css({'width' : imageReelWidth});
        
        //Paging + Slider Function
        rotate = function(){    
                var triggerID = $active.attr("rel") - 1; //Get number of times to slide
                <?php if(Util::EsIE()):?>
                        var image_reelPosition = triggerID * imageWidth+6*triggerID; //Determines the distance the image reel needs to slide
                <?php else :?>
                        var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide
                <?php endif;?>
                $(".paging a").removeClass('active'); //Remove all active class
                $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
                
                //Slider Animation
                $(".image_reel").animate({ 
                        left: -image_reelPosition
                }, 500 );
                
        }; 
        
        //Rotation + Timing Event
        rotateSwitch = function(){              
                play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
                        $active = $('.paging a.active').next();
                        if ( $active.length === 0) { //If paging reaches the end...
                                $active = $('.paging a:first'); //go back to first
                        }
                        rotate(); //Trigger the paging and slider function
                }, 7000); //Timer speed in milliseconds (3 seconds)
        };
        
        rotateSwitch(); //Run function on launch
        
        //On Hover
        $(".image_reel a").hover(function() {
                clearInterval(play); //Stop the rotation
        }, function() {
                rotateSwitch(); //Resume rotation
        });     
        
        //On Click
        $(".paging a").click(function() {       
                $active = $(this); //Activate the clicked paging
                //Reset Timer
                clearInterval(play); //Stop the rotation
                rotate(); //Trigger rotation immediately
                rotateSwitch(); // Resume rotation
                return false; //Prevent browser jump to link anchor
        });     
        
});


$(document).ready(function(){
   $("a#link_noticia").each(function(){
      var href = $(this).attr("href");
      var nombre = $(this).attr("name");
      $(this).attr({ href: "#"+nombre});
      $(this).click(function(){
		$("#frame_principal").html('Cargando Noticia...');
		$("#frame_principal").load(href);         
      });
   });
});

</script>

<script type="text/javascript">
	$(document).ready(function() {
		
		$('blockquote').quovolver();
		
	});
</script>
<link rel="stylesheet" type="text/css" href="stylo_fng.css">

<table width="792" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#c3c3c3 1px solid; border-bottom:#dedede 1px solid; font-family:Arial, Helvetica, sans-serif; color:#4b4b4b;">
	<tr>
		<td bgcolor="#f5f5f5" width="790px">
  			<div class="main_view">
		    	<div class="window">
		        	<div class="image_reel">
				        <?php foreach ($banners as $banner):?>
				            <a href="index.php?c=eventos&m=detalle&id=<?php echo $banner->id_evento?>"><img src="fotos/banners/<?php echo $banner->banner?>" alt="" /></a>
				        <?php endforeach;?>
				        <a href="#"><img src="reel_4.jpg" alt="" /></a>                        
		        	</div>
		    	</div>
		    	<div class="paging">
			        <?php for ($i=1;$i<=count($banners);$i++):?>
			        	<a href="#" rel="<?php echo $i?>"><?php echo $i?></a>
			        <?php endfor;?>
		    	</div>
			</div>    
    	</td>
  	</tr>
</table>
<br />
<?php foreach ($publicaciones as $publicacion):?>
<table class="contentpaneopen">
	<tbody>
		<tr>
			<td class="contentheading" width="100%">
				<?php echo Util::DecodificarCaracteres($publicacion->titulo)?>			
			</td>
						
			<td align="right" width="100%" class="buttonheading">
				<?php if(count($publicacion->Articulos)>0):?>
					<a href="index.php?c=publicaciones&m=articulo_pdf&id=<?php echo $publicacion->Articulos[0]->id_articulo?>" target="_blank"><img src="view/imagenes/pdf_button.png" alt="PDF"></a>
				<?php else :?>
					<a href="index.php?c=publicaciones&m=revista_pdf&id=<?php echo $publicacion->Revistas[0]->id_revista?>" target="_blank"><img src="view/imagenes/pdf_button.png" alt="PDF"></a>
				<?php endif;?>
			</td>
						
			<td align="right" width="100%" class="buttonheading">
				<?php if(count($publicacion->Articulos)>0):?>
					<a href="index.php?c=publicaciones&m=imprimir_articulo&id=<?php echo $publicacion->Articulos[0]->id_articulo?>" target="_blank"><img src="view/imagenes/printButton.png" alt="Imprimir"></a>	
				<?php else :?>
					<a href="index.php?c=publicaciones&m=imprimir_revista&id=<?php echo $publicacion->Revistas[0]->id_revista?>" target="_blank"><img src="view/imagenes/printButton.png" alt="Imprimir"></a>	
				<?php endif;?>
			</td>
			
		</tr>
	</tbody>
</table>
				
<table class="contentpaneopen">
	<tbody>
		<tr>
			<td valign="top" colspan="2" class="createdate">
				Creado el <?php echo $publicacion->fecha_registro?>
			</td>
		</tr>
		<tr>
			<td valign="top" colspan="2" align="justify">
				<p>
				<?php if(count($publicacion->Articulos)>0):?>
					<?php echo Util::UbicarSudCadena($publicacion->Articulos[0]->resumen,'<hr />')<1?Util::DecodificarCaracteres($publicacion->Articulos[0]->resumen):Util::CortarCadena(Util::DecodificarCaracteres($publicacion->Articulos[0]->resumen),Util::UbicarSudCadena($publicacion->Articulos[0]->resumen,'<hr />'))?>
				<?php else :?>
					<?php if(!empty($publicacion->Revistas[0]->portada)):?>
						<img src="fotos/revistas/<?php echo $publicacion->Revistas[0]->portada?>" border="0" alt="Portada" title="Portada" hspace="6" vspace="0" width="80" height="120" align="left">
					<?php endif;?>
					<?php echo Util::UbicarSudCadena($publicacion->Revistas[0]->descripcion,'<hr />')<1?Util::DecodificarCaracteres($publicacion->Revistas[0]->descripcion):Util::CortarCadena(Util::DecodificarCaracteres($publicacion->Revistas[0]->descripcion),Util::UbicarSudCadena($publicacion->Revistas[0]->descripcion,'<hr />'))?>
				<?php endif;?>
				</p>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="modifydate">
				Última actualización el <?php echo $publicacion->fecha_modificacion?>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				
				<?php if(count($publicacion->Articulos)>0):?>
					<a href="index.php?c=publicaciones&m=detalle_articulo&id=<?php echo $publicacion->Articulos[0]->id_articulo?>" class="readon">
				<?php else :?>
					<a href="index.php?c=publicaciones&m=detalle_revista&id=<?php echo $publicacion->Revistas[0]->id_revista?>" class="readon">
				<?php endif;?>
					Leer más...
				</a>
			</td>
		</tr>
	</tbody>
</table>
<span class="article_separator">&nbsp;</span>
<br>
<?php endforeach;?>
<br />
<br /><table border="0" width="100%">
	<tr>
		<td align="left" width="35%"><?php echo !empty($atras)?"<a id='link_producto' href='index.php?pagina=$atras'>« Atras</a>":''?></td>
		<td align="center" width="30%" style="font-size:11px; padding:5px; text-align:center"><strong>Total de Publicaciones: <?php echo $total_resultados?></strong></td>
		<td align="right" width="35%"><?php echo !empty($siguiente)?"<a id='link_producto' href='index.php?pagina=$siguiente'>Siguiente »</a>":''?></td>
	</tr>
</table>
